﻿//-----------------------------------------------------------------------------
// File: SettingsFactory.cs
// Author: Pierre Biermann (tauron031@gmail.com)
// Project: FFMPEG audio video converter class library
// Namespace(s): FFShellAPI.FFMPEG
//
// Desc: Settings factory class.
//       
// (c) 2007 - 2013 by Pierre Biermann
//-----------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FFShellAPI.FFMPEG.Settings
{
    public static class SettingsFactory
    {
        /// <summary>
        /// Low Quality Bitrate
        /// </summary>
        public const int LQVideoBitrate = 256;
        /// <summary>
        /// Medium Quality Bitrate
        /// </summary>
        public const int MQVideoBitrate = 512;
        /// <summary>
        /// High Quality Bitrate
        /// </summary>
        public const int HQVideoBitrate = 756;
        /// <summary>
        /// Very High Quality Bitrate
        /// </summary>
        public const int VHQVideoBitrate = 1024;
        /// <summary>
        /// Super High Quality Bitrate
        /// </summary>
        public const int SHQVideoBitrate = 2048;

        /// <summary>SQCIF (128x96)</summary>
        public const string Resolution_SQCIF = "128x96";
        /// <summary>SQCIF (76x144)</summary>
        public const string Resolution_QCIF = "176x144";
        /// <summary>CIF (352x288)</summary>
        public const string Resolution_CIF = "352x288";
        /// <summary>4CIF (704x576)</summary>
        public const string Resolution_4CIF = "704x576";
        /// <summary>16CIF (1408x1152)</summary>
        public const string Resolution_16CIF = "1408x1152";
        /// <summary>QQVGA (160x120)</summary>
        public const string Resolution_QQVGA = "160x120";
        /// <summary>QVGA (320x240)</summary>
        public const string Resolution_QVGA = "320x240";
        /// <summary>VGA (640x480)</summary>
        public const string Resolution_VGA = "640x480";
        /// <summary>SVGA (800x600)</summary>
        public const string Resolution_SVGA = "800x600";
        /// <summary>XGA (1024x768)</summary>
        public const string Resolution_XGA = "1024x768";
        /// <summary>UXGA (1600x1200)</summary>
        public const string Resolution_UXGA = "1600x1200";
        /// <summary>QXGA (2048x1536)</summary>
        public const string Resolution_QXGA = "2048x1536";
        /// <summary>SXGA (1280x1024)</summary>
        public const string Resolution_SXGA = "1280x1024";
        /// <summary>QSXGA (2560x2048)</summary>
        public const string Resolution_QSXGA = "2560x2048";
        /// <summary>HSXGA (5120x4096)</summary>
        public const string Resolution_HSXGA = "5120x4096";
        /// <summary>WVGA (852x480)</summary>
        public const string Resolution_WVGA = "852x480";
        /// <summary>WXGA (1366x768)</summary>
        public const string Resolution_WXGA = "1366x768";
        /// <summary>WXGA (1366x768)</summary>
        public const string Resolution_WSXGA = "1600x1024";
        /// <summary>WUXGA(1920x1200)</summary>
        public const string Resolution_WUXGA = "1920x1200";
        /// <summary>WOXGA (2560x1600)</summary>
        public const string Resolution_WOXGA = "2560x1600";
        /// <summary>WQSXGA (3200x2048)</summary>
        public const string Resolution_WQSXGA = "3200x2048";
        /// <summary>WQUXGA (3840x2400)</summary>
        public const string Resolution_WQUXGA = "3840x2400";
        /// <summary>WHSXGA (6400x4096)</summary>
        public const string Resolution_WHSXGA = "6400x4096";
        /// <summary>WHUXGA (7680x4800)</summary>
        public const string Resolution_WHUXGA = "7680x4800";
        /// <summary>CGA (320x200)</summary>
        public const string Resolution_CGA = "320x200";
        /// <summary>EGA (640x350)</summary>
        public const string Resolution_EGA = "640x350";
        /// <summary>HD480 (852x480)</summary>
        public const string Resolution_HD480 = "852x480";
        /// <summary>HD720 (1280x720)</summary>
        public const string Resolution_HD720 = "1280x720";
        /// <summary>HD1080 (1920x1080)</summary>
        public const string Resolution_HD1080 = "1920x1080";

        /// <summary>
        /// Low Quality Bitrate
        /// </summary>
        public const int LQAudioBitrate = 32;
        /// <summary>
        /// Medium Quality Bitrate
        /// </summary>
        public const int MQAudioBitrate = 64;
        /// <summary>
        /// High Quality Bitrate
        /// </summary>
        public const int HQAudioBitrate = 96;
        /// <summary>
        /// Very High Quality Bitrate
        /// </summary>
        public const int VHQAudioBitrate = 128;
        /// <summary>
        /// Super High Quality Bitrate
        /// </summary>
        public const int SHQAudioBitrate = 192;

        /// <summary>
        /// Low Audio Sampling Frequency
        /// </summary>
        public const int LQAudioSamplingFrequency = 11025;
        /// <summary>
        /// Medium Audio Sampling Frequency
        /// </summary>
        public const int MQAudioSamplingFrequency = 22050;
        /// <summary>
        /// High Audio Sampling Frequency
        /// </summary>
        public const int HQAudioSamplingFrequency = 44100;

        /// <summary>
        /// Audio Channel Mono
        /// </summary>
        public const int AudioChannelMono = 1;
        /// <summary>
        /// Audio Channel Stereo
        /// </summary>
        public const int AudioChannelStereo = 2;

        /// <summary>
        /// Returns a array with default screen resolutions.
        /// </summary>
        /// <returns>array with resolutions</returns>
        public static string[] GetDefaultResolutions()
        {
            string[] res = new string[29];
            res[0] = Resolution_SQCIF;
            res[1] = Resolution_QCIF;
            res[2] = Resolution_CIF;
            res[3] = Resolution_4CIF;
            res[4] = Resolution_16CIF;
            res[5] = Resolution_QQVGA;
            res[6] = Resolution_QVGA;
            res[7] = Resolution_VGA;
            res[8] = Resolution_SVGA;
            res[9] = Resolution_XGA;
            res[10] = Resolution_UXGA;
            res[11] = Resolution_QXGA;
            res[12] = Resolution_SXGA;
            res[13] = Resolution_QSXGA;
            res[14] = Resolution_HSXGA;
            res[15] = Resolution_WVGA;
            res[16] = Resolution_WXGA;
            res[17] = Resolution_WSXGA;
            res[18] = Resolution_WUXGA;
            res[19] = Resolution_WOXGA;
            res[20] = Resolution_WQSXGA;
            res[21] = Resolution_WQUXGA;
            res[22] = Resolution_WHSXGA;
            res[23] = Resolution_WHUXGA;
            res[24] = Resolution_CGA;
            res[25] = Resolution_EGA;
            res[26] = Resolution_HD480;
            res[27] = Resolution_HD720;
            res[28] = Resolution_HD1080;
            return res;
        }

        /// <summary>
        /// Low Quality FLV-Format.
        /// </summary>
        public static ConversionSettings FLVLowQualityQCIF
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = LQVideoBitrate;
                mset.TargetSettings.ForceFormat = true;
                mset.VideoSettings.CodecName = "flv";
                mset.VideoSettings.VideoResolution = Resolution_QCIF;
                mset.AudioSettings.Bitrate = LQAudioBitrate;
                mset.AudioSettings.SampleRate = LQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 1;
                return mset;
            }
        }

        /// <summary>
        /// Medium Quality FLV-Format.
        /// </summary>
        public static ConversionSettings FLVMediumQualityCIF
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = MQVideoBitrate;
                mset.TargetSettings.ForceFormat = true;
                mset.VideoSettings.CodecName = "flv";
                mset.VideoSettings.VideoResolution = Resolution_CIF;
                mset.AudioSettings.Bitrate = MQAudioBitrate;
                mset.AudioSettings.SampleRate = MQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 2;
                return mset;
            }
        }

        /// <summary>
        /// High Quality FLV-Format.
        /// </summary>
        public static ConversionSettings FLVHighQualityVGA
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = HQVideoBitrate;
                mset.TargetSettings.ForceFormat = true;
                mset.VideoSettings.CodecName = "flv";
                mset.VideoSettings.VideoResolution = Resolution_VGA;
                mset.AudioSettings.Bitrate = HQAudioBitrate;
                mset.AudioSettings.SampleRate = HQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 2;
                return mset;
            }
        }

        /// <summary>
        /// Very high Quality FLV-Format.
        /// </summary>
        public static ConversionSettings FLVVeryHighQualitySVGA
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = VHQVideoBitrate;
                mset.TargetSettings.ForceFormat = true;
                mset.VideoSettings.CodecName = "flv";
                mset.VideoSettings.VideoResolution = Resolution_SVGA;
                mset.AudioSettings.Bitrate = VHQAudioBitrate;
                mset.AudioSettings.SampleRate = HQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 2;
                return mset;
            }
        }

        /// <summary>
        /// Low Quality MP4-Format.
        /// </summary>
        public static ConversionSettings MP4LowQualityQVGA
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = LQVideoBitrate;
                mset.TargetSettings.ForceFormat = true;
                mset.VideoSettings.CodecName = "mp4";
                mset.VideoSettings.VideoResolution = Resolution_QVGA;
                mset.AudioSettings.Bitrate = LQAudioBitrate;
                mset.AudioSettings.SampleRate = LQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 1;
                return mset;
            }
        }

        /// <summary>
        /// Medium Quality MP4-Format.
        /// </summary>
        public static ConversionSettings MP4MediumQualityCIF
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = MQVideoBitrate;
                mset.TargetSettings.ForceFormat = true;
                mset.VideoSettings.CodecName = "mp4";
                mset.VideoSettings.VideoResolution = Resolution_CIF;
                mset.AudioSettings.Bitrate = MQAudioBitrate;
                mset.AudioSettings.SampleRate = MQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 2;
                return mset;
            }
        }

        /// <summary>
        /// High Quality FLV-Format.
        /// </summary>
        public static ConversionSettings MP4HighQualityVGA
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = HQVideoBitrate;
                mset.TargetSettings.ForceFormat = true;
                mset.VideoSettings.CodecName = "mp4";
                mset.VideoSettings.VideoResolution = Resolution_VGA;
                mset.AudioSettings.Bitrate = HQAudioBitrate;
                mset.AudioSettings.SampleRate = HQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 2;
                return mset;
            }
        }

        /// <summary>
        /// Medium Quality WMV-Format.
        /// </summary>
        public static ConversionSettings WMVMediumQualityCIF
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = MQVideoBitrate;
                mset.TargetSettings.ForceFormat = false;
                mset.VideoSettings.CodecName = "wmv2";
                mset.VideoSettings.VideoResolution = Resolution_CIF;
                mset.AudioSettings.CodecName = "wmav2";
                mset.AudioSettings.Bitrate = MQAudioBitrate;
                mset.AudioSettings.SampleRate = MQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 2;
                return mset;
            }
        }

        /// <summary>
        /// High Quality WMV-Format.
        /// </summary>
        public static ConversionSettings WMVHighQualityVGA
        {
            get
            {
                ConversionSettings mset = new ConversionSettings();
                mset.VideoSettings.Bitrate = HQVideoBitrate;
                mset.TargetSettings.ForceFormat = false;
                mset.VideoSettings.CodecName = "wmv2";
                mset.VideoSettings.VideoResolution = Resolution_VGA;
                mset.AudioSettings.CodecName = "wmav2";
                mset.AudioSettings.Bitrate = VHQAudioBitrate;
                mset.AudioSettings.SampleRate = HQAudioSamplingFrequency;
                mset.AudioSettings.Channels = 2;
                return mset;
            }
        }
    }
}
